package com.webtest.filter;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.*;
import java.io.IOException;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2018/8/15 11:34
 */
public class HelloFilter implements Filter {
    private static final Logger LOGGER = LoggerFactory.getLogger(HelloFilter.class);

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        LOGGER.info("init...");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        LOGGER.info("before hellofilter doFilter...");

        //方形
        filterChain.doFilter(servletRequest, servletResponse);
        LOGGER.info("after hellofilter doFilter...");
    }

    @Override
    public void destroy() {
        LOGGER.info("destroy...");
    }
}
